import { defineStore } from 'pinia'
import { ref } from 'vue'
import { scrollTop } from '@/utils/index'
export const useNoteTag = defineStore(
  'TagStore',
  () => {
    const target = ref('')
    const set = (data) => {
      if (target.value == data) {
        target.value = null
      } else {
        target.value = data
      }
      scrollTop()
    }
    const get = () => {
      return target.value
    }
    return {
      set,
      get
    }
  },
  {
    persist: {
      enabled: true,
      strategies: [
        {
          key: 'TagStore',
          storage: sessionStorage,
          paths: ['TagStore']
        }
      ]
    }
  }
)
